home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume7 / 2.11news / patch08 < prev    next >
Encoding:
Text File  |  1987-04-12  |  10.5 KB  |  438 lines

  1. /* Written 11:30 pm  Apr 10, 1987 by rick@seismo.UUCP in mirror:news.software.b */
  2. /* ---------- "patch #8 for news 2.11 src (IMPORTA" ---------- */
  3. If you have installed patch #6 it is important that you install this
  4. patch. (Having installed #7 implies that you have installed #6).
  5. Patch #6 added locking so that only 1 newgroup message at a time
  6. would be running. Unfortunately, if the newgroup message was for a
  7. group that already existed, you did a premature return and did
  8. not unlock inews.
  9.  
  10. Description:
  11.     This is patch #8 for news 2.11 source. It addresses the following
  12.     problems:
  13.  
  14.     The newgroup locking mentioned above.
  15.     Cancel control messages for articles that were non-existant are
  16.     not forwarded.
  17.     If SPOOLNEWS is defined, locally generated articles (i.e. inews
  18.     not rnews) are processed immediately unless SPOOLINEWS is defined.
  19.     Several defines that are no longer used were removed.
  20.     The SPOOLNEWS code was made a little more readable.
  21.     A temporary file used for rnews -U interlocking is now removed.
  22.  
  23. Fix:
  24.     cd to the src directory and apply the following patch
  25.  
  26. Index: patchlevel.h
  27. Prereq: 7
  28. *** .d/patchlevel.h    Tue Apr  7 13:58:31 1987
  29. --- patchlevel.h    Fri Apr 10 23:40:11 1987
  30. ***************
  31. *** 1,3 ****
  32. ! #define    PATCHLEVEL    7
  33.   
  34. ! #define NEWS_VERSION   "B 2.11 4/06/87"
  35. --- 1,3 ----
  36. ! #define    PATCHLEVEL    8
  37.   
  38. ! #define NEWS_VERSION   "B 2.11 4/10/87"
  39.  
  40. Index: control.c
  41. Prereq: 2.53
  42. *** .d/control.c    Tue Mar 24 13:51:24 1987
  43. --- control.c    Fri Apr 10 23:40:06 1987
  44. ***************
  45. *** 20,24 ****
  46.   
  47.   #ifdef SCCSID
  48. ! static char    *SccsId = "@(#)control.c    2.53    3/20/87";
  49.   #endif /* SCCSID */
  50.   
  51. --- 20,24 ----
  52.   
  53.   #ifdef SCCSID
  54. ! static char    *SccsId = "@(#)control.c    2.54    4/10/87";
  55.   #endif /* SCCSID */
  56.   
  57. ***************
  58. *** 57,65 ****
  59.    */
  60.   
  61. - static int is_proc;
  62.   
  63. ! control(h, isproc)
  64.   struct hbuf *h;
  65. - int isproc;
  66.   {
  67.       register char *ctlmsgtext;
  68. --- 57,63 ----
  69.    */
  70.   
  71.   
  72. ! control(h)
  73.   struct hbuf *h;
  74.   {
  75.       register char *ctlmsgtext;
  76. ***************
  77. *** 66,70 ****
  78.       register struct msgtype *mp;
  79.   
  80. -     is_proc = isproc;
  81.       if (strncmp(h->title, "cmsg ", 5) == 0) {
  82.           register char *cp1, *cp2;
  83. --- 64,67 ----
  84. ***************
  85. *** 397,402 ****
  86.   #endif /* NONEWGROUPS */
  87.               } else {
  88. !                 if (*p != 'm')
  89.                       return 0;
  90.   # ifdef NONEWGROUPS
  91.                   if(can_change)  {
  92. --- 394,401 ----
  93.   #endif /* NONEWGROUPS */
  94.               } else {
  95. !                 if (*p != 'm') {
  96. !                     unlock();
  97.                       return 0;
  98. +                 }
  99.   # ifdef NONEWGROUPS
  100.                   if(can_change)  {
  101. ***************
  102. *** 644,648 ****
  103.              tm->tm_min);
  104.           savehist(bfr);
  105. !         return is_proc ? 0 : 1;
  106.       }
  107.   
  108. --- 643,647 ----
  109.              tm->tm_min);
  110.           savehist(bfr);
  111. !         return -1;
  112.       }
  113.   
  114. ***************
  115. *** 652,656 ****
  116.           *q = '\0';
  117.           log("Expired article %s", line);
  118. !         return is_proc ? 0 : 1;
  119.       }
  120.       if (strcmp(p, "cancelled") == 0) {
  121. --- 651,655 ----
  122.           *q = '\0';
  123.           log("Expired article %s", line);
  124. !         return -1;
  125.       }
  126.       if (strcmp(p, "cancelled") == 0) {
  127. ***************
  128. *** 657,661 ****
  129.           *q = '\0';
  130.           log("Already Cancelled %s", line);
  131. !         return is_proc ? 0 : 1;
  132.       } else
  133.           log("Cancelling %s", line);
  134. --- 656,660 ----
  135.           *q = '\0';
  136.           log("Already Cancelled %s", line);
  137. !         return -1;
  138.       } else
  139.           log("Cancelling %s", line);
  140.  
  141. Index: defs.dist
  142. Prereq: 2.57
  143. *** .d/defs.dist    Tue Mar 24 13:56:06 1987
  144. --- defs.dist    Fri Apr 10 23:40:06 1987
  145. ***************
  146. *** 15,19 ****
  147.    */
  148.   
  149. ! /*    @(#)defs.dist    2.57    3/23/87    */
  150.   
  151.   /*
  152. --- 15,19 ----
  153.    */
  154.   
  155. ! /*    @(#)defs.dist    2.58    4/10/87     */
  156.   
  157.   /*
  158. ***************
  159. *** 50,55 ****
  160.   #define MANUALLY        /* Don't execute rmgroups, just notify.    */
  161.   /* #define NONEWGROUPS        /* Don't create new groups, just notify.*/
  162. ! #define BATCH "unbatch"        /* name of unbatcher         */
  163. ! /* #define SPOOLNEWS        /* Spool incoming news, don't process    */
  164.   /* #define LOCALNAME         /* There is no full name database.     */
  165.   /* #define INTERNET        /* Internet mail works locally        */
  166. --- 50,55 ----
  167.   #define MANUALLY        /* Don't execute rmgroups, just notify.    */
  168.   /* #define NONEWGROUPS        /* Don't create new groups, just notify.*/
  169. ! /* #define SPOOLNEWS        /* Spool incoming rnews, don't process    */
  170. ! /* #define SPOOLINEWS        /* Spool local inews, don't process    */
  171.   /* #define LOCALNAME         /* There is no full name database.     */
  172.   /* #define INTERNET        /* Internet mail works locally        */
  173.  
  174. Index: ifuncs.c
  175. Prereq: 2.64
  176. *** .d/ifuncs.c    Tue Apr  7 13:58:42 1987
  177. --- ifuncs.c    Fri Apr 10 23:40:09 1987
  178. ***************
  179. *** 17,21 ****
  180.   
  181.   #ifdef SCCSID
  182. ! static char    *SccsId = "@(#)ifuncs.c    2.64    4/6/87";
  183.   #endif /* SCCSID */
  184.   
  185. --- 17,21 ----
  186.   
  187.   #ifdef SCCSID
  188. ! static char    *SccsId = "@(#)ifuncs.c    2.65    4/10/87";
  189.   #endif /* SCCSID */
  190.   
  191. ***************
  192. *** 24,29 ****
  193.   /*LINTLIBRARY*/
  194.   
  195. - #define AFSIZ    4000    /* size of text in the active file for initial malloc */
  196.   /*
  197.    * Transmit this article to all interested systems.
  198. --- 24,27 ----
  199. ***************
  200. *** 1026,1030 ****
  201.   }
  202.   
  203. - #ifdef BATCH
  204.   /*
  205.    * If the stdin begins with "#" the input is some kind of batch.  if
  206. --- 1024,1027 ----
  207. ***************
  208. *** 1307,1311 ****
  209.       xxit(2);
  210.   }
  211. - #endif /* BATCH */
  212.   
  213.   /*
  214. --- 1304,1307 ----
  215.  
  216. Index: inews.c
  217. Prereq: 2.79
  218. *** .d/inews.c    Tue Apr  7 13:58:48 1987
  219. --- inews.c    Fri Apr 10 23:40:11 1987
  220. ***************
  221. *** 18,22 ****
  222.   
  223.   #ifdef SCCSID
  224. ! static char    *SccsId = "@(#)inews.c    2.79    4/6/87";
  225.   #endif /* SCCSID */
  226.   
  227. --- 18,22 ----
  228.   
  229.   #ifdef SCCSID
  230. ! static char    *SccsId = "@(#)inews.c    2.80    4/10/87";
  231.   #endif /* SCCSID */
  232.   
  233. ***************
  234. *** 52,58 ****
  235.   #define    CREATENG 0020    /* Create a new newsgroup */
  236.   
  237. ! char    forgedname[NAMELEN];    /* A user specified -f option. */
  238. ! int spool_news = 0;
  239.   extern char histline[];
  240.   /* Fake sys line in case they forget their own system */
  241.   struct srec dummy_srec = { "MEMEME", "", "all", "", "" };
  242. --- 52,62 ----
  243.   #define    CREATENG 0020    /* Create a new newsgroup */
  244.   
  245. ! #define DONT_SPOOL    0
  246. ! #define    DO_SPOOL    1
  247. ! #define    EXPIRE_RUNNING    2
  248. ! int spool_news = DONT_SPOOL;
  249.   extern char histline[];
  250. + char    forgedname[NAMELEN];    /* A user specified -f option. */
  251.   /* Fake sys line in case they forget their own system */
  252.   struct srec dummy_srec = { "MEMEME", "", "all", "", "" };
  253. ***************
  254. *** 153,157 ****
  255.   #endif    /* !BSD4_2 */
  256.               xerror("Can't lock %s: %s", ACTIVE, errmsg(errno));
  257. !         spool_news = 2;
  258.       } else {
  259.   #ifdef SPOOLNEWS
  260. --- 157,161 ----
  261.   #endif    /* !BSD4_2 */
  262.               xerror("Can't lock %s: %s", ACTIVE, errmsg(errno));
  263. !         spool_news = EXPIRE_RUNNING;
  264.       } else {
  265.   #ifdef SPOOLNEWS
  266. ***************
  267. *** 161,169 ****
  268.               Sflag = 1;
  269.           } else
  270. !             spool_news = 1;
  271.   
  272.   #endif /* SPOOLNEWS */
  273.       }
  274. !     if (spool_news != 2) {
  275.           /* only unlock if we locked */
  276.   #ifdef    LOCKF
  277. --- 165,173 ----
  278.               Sflag = 1;
  279.           } else
  280. !             spool_news = DO_SPOOL;
  281.   
  282.   #endif /* SPOOLNEWS */
  283.       }
  284. !     if (spool_news != EXPIRE_RUNNING) {
  285.           /* only unlock if we locked */
  286.   #ifdef    LOCKF
  287. ***************
  288. *** 181,185 ****
  289.       }
  290.       if (argc > 1 && !strcmp(*(argv+1), "-U")) {
  291. !         if (spool_news > 1) /* can't unspool while things are locked */
  292.               xxit(0);
  293.           dounspool();
  294. --- 185,190 ----
  295.       }
  296.       if (argc > 1 && !strcmp(*(argv+1), "-U")) {
  297. !         /* can't unspool while things are locked */
  298. !         if (spool_news == EXPIRE_RUNNING)
  299.               xxit(0);
  300.           dounspool();
  301. ***************
  302. *** 189,193 ****
  303.       if (!strncmp(ptr+1, "rnews", 5)) {
  304.           mode = PROC;
  305. !         if (spool_news) {
  306.               dospool((char *)NULL, FALSE);
  307.               /* NOT REACHED */
  308. --- 194,198 ----
  309.       if (!strncmp(ptr+1, "rnews", 5)) {
  310.           mode = PROC;
  311. !         if (spool_news != DONT_SPOOL) {
  312.               dospool((char *)NULL, FALSE);
  313.               /* NOT REACHED */
  314. ***************
  315. *** 197,203 ****
  316.               (void) nice(NICENESS);
  317.   #endif /* NICENESS */
  318. !     } else
  319.           if (argc < 2)
  320.               goto usage;
  321.   
  322.       state = OPTION;
  323. --- 202,214 ----
  324.               (void) nice(NICENESS);
  325.   #endif /* NICENESS */
  326. !     } else {
  327. !     /* it's not rnews, so it must be inews */
  328.           if (argc < 2)
  329.               goto usage;
  330. + #ifndef SPOOLINEWS
  331. +         if (spool_news == DO_SPOOL)
  332. +             spool_news = DONT_SPOOL;
  333. + #endif /* SPOOLINEWS */
  334. +     }
  335.   
  336.       state = OPTION;
  337. ***************
  338. *** 355,358 ****
  339. --- 366,370 ----
  340.               /* there are certain fields we won't let him specify. */
  341.               if (header.from[0]) {
  342. +                 (void) fixfrom(header.from);
  343.                   if (Sflag && !Mflag && !header.approved[0] &
  344.                       !header.sender[0]) {
  345. ***************
  346. *** 437,443 ****
  347.       /* Authorize newsgroups. */
  348.       if (mode == PROC) {
  349. - #ifdef BATCH
  350.           checkbatch();
  351. - #endif /* BATCH */
  352.           (void) signal(SIGHUP, SIG_IGN);
  353.           (void) signal(SIGINT, SIG_IGN);
  354. --- 449,453 ----
  355. ***************
  356. *** 846,851 ****
  357.           tm->tm_mon+1, tm->tm_mday, tm->tm_year,tm->tm_hour, tm->tm_min);
  358.       addhist(bfr);
  359. !     log("%s %s ng %s subj '%s' from %s",
  360. !         spool_news ? "queued" : (mode==PROC ? "received" : "posted"),
  361.           header.ident, header.nbuf, header.title, header.from);
  362.   
  363. --- 856,861 ----
  364.           tm->tm_mon+1, tm->tm_mday, tm->tm_year,tm->tm_hour, tm->tm_min);
  365.       addhist(bfr);
  366. !     log("%s %s ng %s subj '%s' from %s", spool_news != DONT_SPOOL
  367. !         ? "queued" : (mode==PROC ? "received" : "posted"),
  368.           header.ident, header.nbuf, header.title, header.from);
  369.   
  370. ***************
  371. *** 928,935 ****
  372.       }
  373.   
  374. !     if (mode != PROC && spool_news)  {
  375. !         if (spool_news == 1 && ngmatch(header.nbuf, "to.all.ctl"))
  376. !             spool_news = 0;
  377. !         if (spool_news) {
  378.               fprintf(stderr,
  379.               "Your article has been spooled for later processing.\n");
  380. --- 938,946 ----
  381.       }
  382.   
  383. !     if (mode != PROC && spool_news != DONT_SPOOL)  {
  384. !         if (spool_news != EXPIRE_RUNNING
  385. !             && ngmatch(header.nbuf,"to.all.ctl"))
  386. !                 spool_news = DONT_SPOOL;
  387. !         if (spool_news != DONT_SPOOL) {
  388.               fprintf(stderr,
  389.               "Your article has been spooled for later processing.\n");
  390. ***************
  391. *** 940,944 ****
  392.   
  393.       if (is_ctl) {
  394. !         exitcode = control(&header, mode == PROC);
  395.           if (localize("control") && exitcode != 0)
  396.               savehist(histline);
  397. --- 951,955 ----
  398.   
  399.       if (is_ctl) {
  400. !         exitcode = control(&header);
  401.           if (localize("control") && exitcode != 0)
  402.               savehist(histline);
  403. ***************
  404. *** 1023,1027 ****
  405.           broadcast(mode==PROC);
  406.       }
  407. !     xxit((mode == PROC && filename[0] == '\0') ? 0 : exitcode);
  408.   }
  409.   
  410. --- 1034,1039 ----
  411.           broadcast(mode==PROC);
  412.       }
  413. !     xxit((mode == PROC && filename[0] == '\0') ? 0 :
  414. !         (exitcode < 0 ? 0 : exitcode));
  415.   }
  416.   
  417. ***************
  418. *** 1271,1276 ****
  419.       sprintf(bfr, "%s.tmp", spbuf);
  420.       (void) close(creat(bfr, 0666));
  421. !     if (LINK(bfr, spbuf) < 0) {
  422. !         (void) UNLINK(bfr);
  423.           if (errno != EEXIST)
  424.   #endif /* V7 */
  425. --- 1283,1291 ----
  426.       sprintf(bfr, "%s.tmp", spbuf);
  427.       (void) close(creat(bfr, 0666));
  428. !     ret = LINK(bfr, spbuf);
  429. !     status = errno;
  430. !     (void) UNLINK(bfr);
  431. !     errno = status;
  432. !     if (ret < 0) {
  433.           if (errno != EEXIST)
  434.   #endif /* V7 */
  435. /* End of text from mirror:news.software.b */
  436.